package system.mapper;

import framework.base.BaseMapper;
import framework.security.RegApproval;
import org.apache.ibatis.annotations.Param;
import system.dto.UserSenseQuery;
import system.dto.sys.SysUserQuery;
import system.entity.SysUser;
import tk.mybatis.mapper.common.Mapper;

import java.util.Date;
import java.util.List;

public interface SysUserMapper extends Mapper<SysUser>, BaseMapper<SysUser, Long> {
    int updateBody(SysUser param);

    @Override
    int insertSelective(SysUser record);

    @Override
    List<SysUser> list(SysUser param);

    /**
     * 获取用户角色权限列表
     *
     * @param id
     * @return
     */
    List<String> loadUserRolePermissions(@Param("id") Long id);

    /**
     * 更新登录信息
     *
     * @param username
     * @param time
     * @param ip
     * @return
     */
    int updateLogin(@Param("username") String username, @Param("time") Date time, @Param("ip") String ip);

    /**
     * 注册审批
     *
     * @param id
     * @param approval
     * @return
     */
    int approve(@Param("id") Long id, @Param("approval") RegApproval approval);

    /**
     * 用户感知
     *
     * @param senseQuery
     * @return
     */
    List<SysUser> sense(UserSenseQuery senseQuery);

    /**
     * 个人资料变更
     *
     * @param user
     */
    int updateProfile(SysUser user);

    /**
     * 搜索
     *
     * @param query
     * @return
     */
    List<SysUser> search(SysUserQuery query);
}